package com.suray.wcs.service.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import com.suray.basic.wcs.utils.IBaseEnum;

import java.io.Serializable;

public enum SysLogType implements IBaseEnum<Serializable> {

    /**
     * 系统日志
     */
    SYSTEMLOG(0, "操作日志"),
    /**
     * 交互日志
     */
    INTERACTIONLOG(1, "交互日志");

    @EnumValue
    private Integer sysLogNum;

    @JsonValue
    private String description;

    @Override
    public String toString() {
        return description;
    }

    public int getSysLogNum() {
        return sysLogNum;
    }

    SysLogType(int sysLogNum, String description) {
        this.sysLogNum = sysLogNum;
        this.description = description;
    }

    public static SysLogType parseLogType(int sysLogNum) {
        for (SysLogType r : SysLogType.values()) {
            if (r.getSysLogNum() == sysLogNum) {
                return r;
            }
        }
        throw new IllegalArgumentException("无法解析未知异常！");
    }

    @Override
    public Serializable getValue() {
        return null;
    }

    @Override
    public String getDescription() {
        return description;
    }

    @Override
    public Integer getVal() {
        return sysLogNum;
    }


}
